#include <stdio.h>
#include "lsd.h"

int lsd_on(Lsd *self)
{
    PRINT_FILE_LINE_FUNC();
    self->state = LIGHT_ON;
    return 0;
}
int lsd_off(Lsd *self)
{
    PRINT_FILE_LINE_FUNC();
    self->state = LIGHT_OFF;
    return 0;
}

int lsd_get_state(Lsd *self, int *state)
{
    PRINT_FILE_LINE_FUNC();
    *state = self->state;
    return 0;
}

Light_i lsd_interface = {
    (light_on_fn_t)lsd_on, 
    (light_off_fn_t)lsd_off, 
    (light_get_state_fn_t)lsd_get_state
};

int lsd_init(Lsd *self)
{
    PRINT_FILE_LINE_FUNC();
    self->interface = &lsd_interface;
    self->state = LIGHT_OFF;
    return 0;
}
